// pages/forgetPass/forgetPass.js
var app = getApp();
var com = require('../../common.js')
Page({
  data: {
    keynumber: '',
    showuum: true
  },
  onLoad: function(options) {
    var _this = this
    _this.setData({
      id:options.id
    })
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  onShareAppMessage: function() {},
  //获取输入的手机号
  phoneNumber(e) {
    var _this = this,
      id = e.currentTarget.id,
      value = e.detail.value
    if (id == 3) {
      _this.setData({
        passwor: value
      })
    } else if (id == 4) {
      if (_this.data.passwor != e.detail.value) {
        console.log(_this.data.passwor, e.detail.value)
        wx.showToast({
          title: '输入密码不一致',
          icon: 'none'
        })
        _this.setData({
          showuum: false
        })
      } else {
        _this.setData({
          showuum: true
        })
      }

    }
  },

  next() {
    var _this = this
    com.link(app.link.onShopInfoPassword + _this.data.id + '.st', {
      password: _this.data.passwor
    }, function(rep) {
      console.log(rep)
      if (rep.data.state) {
        wx.showToast({
          title: '操作成功',
          icon: 'success'
        })
        setTimeout(() => {
          wx.navigateBack({
            delta: 1
          })
        },1400)
      } else {
        wx.showToast({
          title: rep.data.message,
          icon: 'none'
        })
      }
    })
  }
})